Skip to main content

Expressions & Operators

There are infinitely many operators and expressions one can create and use.

Hedgehog Script has some built-in ones, and we'll briefly cover some here.

  • An expression is defined as:

    • A "valid set of literals, variables, opereators and expressions that evaluate to a single value that is an expression".
  • Operators are defined as:

    • "Special symbols used to perform operations on operands (values and variables)".

Let's name a few very common, fundamental ones:

  • +, -, /, * (addition, subtraction/difference, division, multiplication)

  • =, +=, -=, *= (assignment, addition/subtraction/multiplication assignment)

  • ">", "<", ">=", "<=" (greater than, less than, greater than or equal to, less than or equal to)

  • &&, ||, ! (logical AND, logical OR, logical NOT/negation)

  • ++, --, **, === (increment, decrement, exponetiation, identity)

  • ? (conditional ternary operator)

  • new operator, ... spread syntax, null, this

Here is an example of some:

Try using others operators or expressions yourself by editing the left-hand side of the Hedgehog Lab environment!

tip

This is just a brief introduction.

To find more detailed information, and a list of all built-in operators/expressions, visit: Ops & Expressions - MDN